﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SMS_Agent.Model;
using SMS_Agent.BLL;

namespace SMS_Agent.View
{
    public partial class frmDetail : Form
    {
        notify currentObj;

        public frmDetail(notify obj)
        {
            InitializeComponent();
            currentObj = obj;
        }

        private void frmDetail_Load(object sender, EventArgs e)
        {
            txtDiaChi.Text = currentObj.khachhang.diachi;
            txtKhachHang.Text = currentObj.khachhang.tenkhachhang;
            txtThongBao.Text = currentObj.thongbao;
            pictureBox1.Image = LoadImage(@"D:\samplemaps.png");
                
        }
        /// <summary>
        /// Load hình dựa vào ImagePath = "D:\image.jpg"
        /// Load không được return null
        /// </summary>
        public static System.Drawing.Image LoadImage(string ImagePath)
        {
            Image img = null;
            try
            {
                img = Image.FromFile(ImagePath);
            }
            catch
            {
                img = null;
            }
            return img;
        }

        private void btnXuLy_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Yes;
        }

        private void btnBoQua_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.No;
        }
    }
}
